package com.hui.server.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hui.server.entity.AdminRole;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author hui
 * @since 2022-04-10
 */
public interface AdminRoleMapper extends BaseMapper<AdminRole> {


    /**
     * 更新用户的角色列表，动态SQL，返回受影响的行数
     * @param adminId
     * @param rids
     */
    @Insert("<script> " +
            "insert into t_admin_role(adminId,rid) values" +
            "<foreach collection=\"rids\" item=\"rid\" separator=\",\">" +
            "(#{adminId},#{rid})" +
            "</foreach>" +
            "</script>")
    Integer updateAdminRole(@Param("adminId") Integer adminId, @Param("rids") Integer[] rids);
}
